package cn.tedu._07springaop.aop;

import org.springframework.stereotype.Component;

/**
 * @Author Justin Parker
 * @Date 2024/8/14 0014 17:41
 * @Version 1.0
 */
@Component
public class CalculatorImpl implements Calculator{


    @Override
    public int add(int x, int y) {

        if (x > 0){
            throw new RuntimeException("x不能大于0");
        }

        int result = x + y;
        System.out.println("目标方法执行");
        return result;
    }

    @Override
    public int sub(int x, int y) {

        int result = x - y;

        return result;
    }

    @Override
    public int mul(int x, int y) {

        int result = x * y;

        return result;
    }

    @Override
    public int div(int x, int y) {

        int result = x / y;
        return result;
    }
}
